|
|
|
|
|
|
|
Rule 4
Isolate Independent Multiple Relationships |
|
|
|
|
|
|
|
|
The fourth rule of data normalization concerns the handling of independent multiple relationships. This rule is applied whenever you have more than one one-to-many relationship on the same data table. The relationship between the Employees table and the EmpSkills table is a one-to-many relationship. There can be many EmpSkills records related to one Employee record. Let's add an additional attribute of employees to create a database that has more than a single one-to-many relationship. |
|
|
|
|
|
|
|
|
Assume that the Human Resources Department has decided it needs more than just the skill names and skill levels attained for each employee. Human Resources also wants to add the level of education attained by the employee for that skill. For example, if the employee has an accounting skill and has an associate's degree in bookkeeping, Human Resources wants to store the degree information, too. If an employee has been certified as an electrician and works in the Maintenance Department, the Human Resources group wants to know that. |
|
|
|
|
|
|
|
|
The first thing you might want to do is add a new column to the EmpSkills tablemaybe a field called Degree, maybe even a field for YearCompleted. This makes sense because each skill might have an associated education component. It makes sense, but it is not a good idea. What about the employee who is currently working in the Customer Service Department but has an accounting degree? Just because the employee has a degree does not mean that employee has the skills to perform a particular job or is working in a position directly related to his or her degree. The degree and the job skills are independent of each other. Therefore, even though the skills data and the degree data are related, they should be isolated in separate tables and linked through a foreign key relationship. |
|
|
|
|
| |
|
|
|
|
The fourth rule of data normalization dictates that no table can contain two or more one-to-many or many-to-many relationships that are not directly related. In other words, if the data element is important (the college degree) but not directly related to other elements in the record (the customer service rep with an accounting degree), you need to move the college degree element to a new table. Databases that follow this rule are in the Fourth Normal Form. |
|
|
|
|
|
|
|
|
|
|
Table 16.4 shows a sample Training table that can be used to hold the education information for each employee. Now the Human Resources department can keep track of education achievements independent of acquired job skills. Note that the EmpID directly connects the |
|
|
|
|
|